package com.cqsw.test;

import com.cqsw.entity.Goods;
import com.cqsw.mapper.goodsMapper;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.Date;
import java.util.List;

@SpringBootTest
public class goods {
    private final goodsMapper goodsMapper;

    @Autowired
    public goods(goodsMapper goodsMapper) {
        this.goodsMapper = goodsMapper;
    }
    @Test
    public void testGetGoodsAllForGoods(){
        List<com.cqsw.entity.Goods> goodsAllforGoods=goodsMapper.selectAllGoods();
        System.out.println("goodsAllforGoods"+goodsAllforGoods);
    }
    @Test
    public void testAdd(){
        Goods goods=new Goods();
        new Date().toString();
        goods.setId(null).setGoodnum("11").setName("手机").setCategory("智能产品")
                .setKeyword("测试").setPicture("111").setDetails("2222")
                .setPrice("0000").setIsOnState(333).setSellCount(444).setOnSaleTime(new Date()).setCategoryId(222).setGoodsId(333);
        System.out.println(goodsMapper.addGoods(goods));

    }
    @Test
    public void testUpdate(){
        Goods goods=new Goods();
        new Date().toString();
        goods.setId(7).setGoodnum("15").setName("手机").setCategory("智能产品")
                .setKeyword("测试").setPicture("123").setDetails("2222")
                .setPrice("0000").setIsOnState(333).setSellCount(555).setOnSaleTime(new Date()).setCategoryId(222).setGoodsId(333);

    }
}
